

//
//  Person.m
//  函数的链式编程
//
//  Created by YYY on 2018/1/15.
//  Copyright © 2018年 YYY. All rights reserved.
//

#import "Person.h"

@implementation Person

- (void)eat
{
    NSLog(@"吃");
}

- (void)sheep
{
    NSLog(@"睡");
}

- (Person *)study
{
    NSLog(@"学习");
    return self;
}

- (Person *)think
{
    NSLog(@"思考");
    return self;
}

- (Person * (^)())smile
{
    NSLog(@"微笑");
    Person * (^method)() = ^{
        return self;
    };
    return method;
}

- (Person * (^)())happy
{
    NSLog(@"高兴");
    return ^{
        return self;
    };
}

- (Person * (^)(NSString *reason))cry
{
    Person * (^method)() = ^(NSString *reason){
        NSLog(@"哭 %@", reason);
        return self;
    };
    return method;
}

- (Person * (^)(NSInteger))crazy
{
    return ^(NSInteger count){
        NSLog(@"疯狂 %ld次", count);
        return self;
    };
}
@end
